import EditorConsole from '../components/EditorConsole'
import {
  propertyExample,
  functionExample,
} from '../examples/property_initializers'


Class properties are a convenient way to declare properties for each instance, equivalent to assigning these properties in the constructor function.

<EditorConsole {...propertyExample} height={400} />

When a function is assigned to a instance property, that function is bound to the instance.

Before ES2016, you might bind functions to class instances in the `constructor`, e.g. `this.func = this.func.bind(this)`. Binding that way ensures that a class's instance function is invoked with the correct context.
With ES2016 class instance properties, we can instead write `func = () => ...`. `func` is then bound to the class instance at construction.

<EditorConsole {...functionExample} height={500} />
